﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MyCollection;


namespace WindowsFormsApplication1
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}

		private void button1_Click(object sender, EventArgs e)
		{
			ChildClass obj = new ChildClass();
			obj = null;
			GC.Collect();
		}

		private void button2_Click(object sender, EventArgs e)
		{

			MyStack<int> stack = new MyStack<int>();
			stack.Push(1);
			stack.Push(2);
			stack.Push(3);
			stack.Push(4);

			StringBuilder sb = new StringBuilder();
			sb.AppendLine(stack.Pop().ToString());
			sb.AppendLine(stack.Pop().ToString());
			sb.AppendLine(stack.Pop().ToString());
			sb.AppendLine(stack.Pop().ToString());
			MessageBox.Show(sb.ToString());

			QueueTwoStacks<int> queueTwoStacks = new QueueTwoStacks<int>();
			queueTwoStacks.Enqueue(1);
			queueTwoStacks.Enqueue(2);
			queueTwoStacks.Enqueue(3);
			queueTwoStacks.Enqueue(4);
			queueTwoStacks.Enqueue(5);
			MessageBox.Show("queueTwoStacks.Dequeue(): " + queueTwoStacks.Dequeue().ToString());

			QueueOneStack<int> queueOneStack = new QueueOneStack<int>();
			queueOneStack.Enqueue(1);
			queueOneStack.Enqueue(2);
			queueOneStack.Enqueue(3);
			queueOneStack.Enqueue(4);
			queueOneStack.Enqueue(5);
			MessageBox.Show("queueOneStack.Dequeue(): " + queueOneStack.Dequeue().ToString());
		}

		private void button3_Click(object sender, EventArgs e)
		{
			Car2 obj = new Car2();
			obj.Drive();
			obj.Drive2();
			((Car)obj).Drive();
			((Car)obj).Drive2();
		}

		private void button4_Click(object sender, EventArgs e)
		{
			MessageBox.Show(Atoi.atoi("-1234567890").ToString());
		}

		private void button5_Click(object sender, EventArgs e)
		{
			ValueAndReference vr = new ValueAndReference();
			vr.RunTest();
		}

		private void button6_Click(object sender, EventArgs e)
		{
			using (DisposeClass disposeObj = new DisposeClass())
			{
			}
			MessageBox.Show("End of using");
		}

		private void button7_Click(object sender, EventArgs e)
		{
			Deadlock deadlock = new Deadlock();
			deadlock.Start();
		}
	}
}
